<template>
  <div class="app-container">
    <div class="search-bar">
      <el-form ref="form" :model="searchData" label-width="80px" size="mini">
        <el-row :gutter="10">
          <el-col :span="3.5">
            <el-form-item label="作业区">
              <el-select v-model="searchData.expapp_areano" clearable placeholder="请选择作业区" style="width:130px">
                <el-option
                  v-for="(item, i) in opeArea"
                  :key="i"
                  :label="item"
                  :value="item"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="3.5">
            <el-form-item label="起始日期">
              <el-date-picker
                v-model="searchData.startTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择日期"
                style="width:150px"
              />
            </el-form-item>
          </el-col>
          <el-col :span="3.5">
            <el-form-item label="截止日期">
              <el-date-picker
                v-model="searchData.endTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择日期"
                style="width:150px"
              />
            </el-form-item>
          </el-col>
          <el-col :span="3.5">
            <el-form-item label="是否有效">
              <el-select v-model="searchData.plan_iseffective" clearable placeholder="请选择效果" style="width:130px">
                <el-option label="有效" value="1" />
                <el-option label="无效" value="0" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" size="mini" @click="search">查 询</el-button>
              <el-button size="mini" @click="reset">清 空</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="content">
      <el-table
        :data="tableData"
        max-height="900"
        border
        :header-cell-style="{height:'30px',padding:'0px',fontSize:'14px'}"
        style="width: 100%;font-size: 13px"
        :row-style="{height:'25px'}"
        :cell-style="{padding:'1px'}"
      >
        <el-table-column
          type="index"
          width="50"
        />
        <el-table-column
          prop="expapp_wellname"
          label="井号"
          sortable
          header-align="center"
          align="center"
        />
        <el-table-column
          prop="expapp_areano"
          label="申请单位"
          width="120"
          sortable
          header-align="center"
          align="center"
        />
        <el-table-column label="正常生产情况" header-align="center">
          <el-table-column
            prop="expapp_normaldailyliquid"
            label="日产液量"
            sortable
            header-align="center"
            align="center"
          />
          <el-table-column
            prop="expapp_normalwatercontent"
            label="含水"
            sortable
            header-align="center"
            align="center"
          />
          <el-table-column
            prop="expapp_normalpumpcondition"
            label="泵况"
            header-align="center"
            align="center"
          />
          <el-table-column
            prop="expapp_normalsunkenness"
            label="沉没度"
            header-align="center"
            align="center"
          />
        </el-table-column>
        <el-table-column label="异常生产情况" header-align="center">
          <el-table-column
            prop="expapp_expdailyliquid"
            label="日产液量"
            width="110"
            header-align="center"
            sortable
            align="center"
          />
<!--          <el-table-column-->
<!--            prop=""-->
<!--            label="日产油量"-->
<!--            width="100"-->
<!--            header-align="center"-->
<!--            sortable-->
<!--            align="center"-->
<!--          />-->
          <el-table-column
            prop="expapp_expwatercontent"
            label="含水"
            sortable
            header-align="center"
            align="center"
          />
          <el-table-column
            prop="expapp_exppumpcondition"
            label="泵况"
            header-align="center"
            align="center"
          />
          <el-table-column
            prop="expapp_expsunkenness"
            label="沉没度"
            header-align="center"
            align="center"
          />
        </el-table-column>
        <el-table-column
          prop="expapp_lastinspectdata"
          label="最后一次检泵日期"
          sortable
          header-align="center"
          align="center"
        />
        <el-table-column
          prop="expapp_antiwaxmethod"
          label="清防蜡方式"
          header-align="center"
          align="center"
        />
        <el-table-column
          prop="expapp_sitecheck"
          label="现场诊断"
          header-align="center"
          align="center"
        />
        <el-table-column
          prop="plan_completedate"
          label="施工日期"
          sortable
          header-align="center"
          align="center"
        />
        <el-table-column
          prop="plan_iseffective"
          label="是否有效"
          sortable
          header-align="center"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.plan_iseffective==0?'无效':'有效' }}
          </template>
        </el-table-column>
      </el-table>
      <Pagination
        :page.sync="page"
        :limit.sync="limit"
        :total="total"
        @changePage="getListPage1(arguments)"
        @size-change="handleSizeChange"
      />
    </div>
  </div>
</template>

<script>
import Pagination from '@/components/pagination.vue'
export default {
  components: { Pagination },
  data() {
    return {
      searchData: {},
      tableData: [],
      opeArea: ['第一采油作业区','第二采油作业区', '第三采油作业区','第五采油作业区','第七采油作业区','第八采油作业区','第九采油作业区','运行维护一中心'],
      page: 1,
      limit: 20,
      total: 0
    }
  },
  created() {
    this.getListPage(this.page, this.limit, this.searchData)
    // this.getListPage()
  },
  methods: {
    getListPage(pageNum, pageSize, data) {
      this.$http.post('/expHotwashapplica/queryPlanExp', {
        pageNum, pageSize, data
      }).then(({data:{data:res}})=> {
        this.tableData = res.records
        this.total = res.total
      }).catch(err => {
        this.$message.error(err)
      })
    },
    //页码变动
    getListPage1(msg){
      let pageNum=msg[0]
      let pageSize=msg[1]
      let data=this.searchData
      this.$http.post('/expHotwashapplica/queryPlanExp', { pageSize, pageNum, data }).then(({ data: { data: res }}) => {
        this.tableData = res.records
        this.total = res.total
      })
    },
    //每页记录数变动
    handleSizeChange(size) {
      let pageSize = this.page
      let pageNum = size
      let data = this.searchData
      this.$http.post('/expHotwashapplica/queryPlanExp', { pageSize, pageNum, data }).then(({ data: { data: res }}) => {
        this.tableData = res.records
        this.total = res.total
      })
    },
    changePage(pageNum, pageSize) {
      this.getListPage(pageNum, pageSize, this.searchData)
    },
    search() {
      this.page = 1
      this.getListPage(this.page, this.limit, this.searchData)
    },
    reset() {
      this.searchData = {}
    }
  }
}
</script>

<style scoped>

</style>
